
var userAgentInfo = navigator.userAgent
var agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPod', 'iPod']

let isPC = () => {
  var flag = true
  for (var i = 0; i < agents.length; i++) {
    if (userAgentInfo.indexOf(agents[i]) > 0) {
      flag = false
      break
    }
  }
  return flag
}

let isIOS = () => {
  var flag = true
  for (var i = 0; i < agents.length; i++) {
    if (userAgentInfo.indexOf('iPhone') > 0 || userAgentInfo.indexOf('iPad') > 0) {
      flag = false
      break
    }
  }
  return flag
}

let isAndroid = () => {
  var flag = true
  for (var i = 0; i < agents.length; i++) {
    if (userAgentInfo.indexOf('Android') > 0) {
      flag = false
      break
    }
  }
  return flag
}

module.exports = {
  isPC,
  isIOS,
  isAndroid
}
